package traveler.controllers;

import traveler.activities.AnswerActivity;
import traveler.activities.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class CourseController extends BaseController implements View.OnClickListener, OnItemClickListener
{
	public final static String BTN_SUBMIT = "Valider";
	
	public CourseController(Activity activity)
	{
		super(activity);
	}
	
	public void onClick(View v)
	{
		Log.i("CourseController", "OnClick - START ");
		
		switch(v.getId())
		{
			case R.id.course_btnSubmit:
				EditText txtAnswer = (EditText)_activity.findViewById(R.id.course_txtAnswer);
				Intent intent = new Intent(_activity, AnswerActivity.class);
				Bundle bundle = new Bundle();
				
				if(txtAnswer.getText().toString().equals("1889"))
					bundle.putInt("image", R.drawable.dora_win);
				else
					bundle.putInt("image", R.drawable.bad_answer);

				intent.putExtras(bundle);
				_activity.startActivity(intent);
				
				break;
		}
		
		Log.i("CourseController", "OnClick - END ");
	}

	public void onItemClick(AdapterView<?> parent, View view, int position, long id)
	{
		
	}	
}
